package 笔试;

import util.datastructure.ListNode;

/**
 * 海航笔试题
 * @author Administrator
 *
 */
public class HaiHang {
	/**
	 * 反转链表：  
	 * @My
	 * @param head
	 * @return
	 */
    public ListNode reverseList2(ListNode head) {
	   if (head == null)	return null;
	   ListNode p = head, q = p.next;
	   ListNode temp = q;
	   p.next = null;
	
	   while (q != null) {
			temp = q.next;
			q.next = p;
			p = q;
			q = temp;
	   }
		//	ListNode.traverse("reverse结果", p);
	   return p;
    }
}
